cmake_minimum_required(VERSION 3.4) # cmake所需最小版本

set(PACKAGE_NAME    "helio") # 设置构建的包名
set(PROJECT_CONTACT yk120889@163.com) # 设置联系人
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # 生成include path

project(${PACKAGE_NAME} C CXX) # 真正的项目名
enable_testing() # 允许进行测试

get_directory_property(PARENT_PROJ_NAME PARENT_DIRECTORY) # 获取属性

Message(STATUS "PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR} GENERATOR ${CMAKE_GENERATOR}")
Message(STATUS "PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR} CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}")

option (BUILD_DOCS "Generate documentation " ON)
option (BUILD_SHARED_LIBS "Build shared libraries" OFF)
option (USE_MOLD "whether to use mold linker" OFF)
option (USE_FB2 "whether to use fibers2 library" OFF)
set    (HELIO_MIMALLOC_OPTS "" CACHE STRING "additional mimalloc compile options")
set    (HELIO_MIMALLOC_LIBNAME "libmimalloc.a" CACHE STRING "name of mimalloc library")

if (PARENT_PROJ_NAME)
  Message(STATUS "PARENT_PROJ_NAME ${PARENT_PROJ_NAME}")
else()
  # 设置cxx的标准
  set(CMAKE_CXX_STANDARD 17)
  list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
  # include三方库
  include(third_party)
  include(internal)
endif()


add_definitions(-DUSE_FB2)

# 增加子目录
add_subdirectory(base)
add_subdirectory(io)
add_subdirectory(examples)
add_subdirectory(strings)
add_subdirectory(util)
